//
//  CAMembersTableViewCell.m
//  LNH
//
//  Created by twentylx on 2018/1/27.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "CAMembersTableViewCell.h"

@implementation CAMembersTableViewCell

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.bgView];
        [self.bgView addSubview:self.nameLabel];
        [self.bgView addSubview:self.moreImageView];
        [self.bgView addSubview:self.lineView];
        
        [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bgView).offset(20);
            make.centerY.equalTo(self.bgView);
        }];
        
        [_moreImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.bgView).offset(-20);
            make.centerY.equalTo(self.bgView);
        }];
        
        [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.and.right.equalTo(self.bgView);
            make.bottom.equalTo(self.bgView);
            make.height.mas_equalTo(ONE_PIXEL);
        }];
        
        
    }
    return self;
}

#pragma mark get & set
- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [UIView new];
        _bgView.backgroundColor = [UIColor whiteColor];
    }
    return _bgView;
}

- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [UILabel new];
        _nameLabel.text = @"张三丰（ID：66666）";
    }
    return _nameLabel;
}

- (UIImageView *)moreImageView {
    if (!_moreImageView) {
        _moreImageView = [UIImageView new];
        _moreImageView.image = LMImageNamed(@"more");
    }
    return _moreImageView;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [UIView new];
        _lineView.backgroundColor = RGBCOLOR(51, 51, 51);
    }
    return _lineView;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
